package com.dog.basics.admin.aspect;

import cn.hutool.json.JSONUtil;
import com.dog.basics.admin.annotation.EncryDecryVerification;
import com.dog.basics.common.util.R;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.CodeSignature;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @description: 加解密切面注入
 * @author: He
 * @date: Created in 2021/7/12 10:07
 * @version: 1.0
 * @modified By:
 */
@Aspect
@Component
public class EncryDecryVerificationAspect {

    /**
     * 环绕通知
     */
    @Around("@annotation(verification)")
    public Object doAround(ProceedingJoinPoint joinPoint, EncryDecryVerification verification) throws Throwable {
        System.out.println("进入切面");

        Object[] paramValues = joinPoint.getArgs();
        System.out.println(paramValues.length+" |"+JSONUtil.toJsonStr(paramValues));

        if (Boolean.FALSE) {
            return R.failed("我就不想让你访问，你能咋地");
        }
        return joinPoint.proceed();
    }



}
